<#include "/common/head.ftl">

<@showTitle title="${i18n.getMessage('bookstore.item')} > ${i18n.getMessage('create_one')}">
	<a href="#" onclick="cc('bookstore/showListOfItem.sgt?programId=${(programId)!}')">${i18n.getMessage('list')}</a>
</@showTitle>

<div id="error" style="display:none"></div>

<form action="bookstore/addItem.sgt" validator="bookstore/validateItem.sgt" onsubmit="submitFormValidation(this); return false;" onreset="$('error').hide()">
	<table id="dataTable" align="center" cellspacing="5" cellpadding="0">
		<tr>
			<td class="name"><@required/>${i18n.getMessage('program')}:</td>
			<td>
				<select id="programId" name="programId" style="width:204px">
					<option value="0"></option>
					<#list programs as each>
						<option value="${each.id}" <#if (each == program!)>selected</#if>>${each.name}</option>
					</#list>
				</select> <span id="progressMsg"></span>
			</td>
		</tr>
		<tr>
			<td class="name"><@required/>${i18n.getMessage('bookstore.title')}:</td>
			<td>
				<select id="titleId" name="titleId" style="width:204px">
					<option></option>
				</select>
			</td>
		</tr>
		<tr>
			<td class="name"><@required/>${i18n.getMessage('bookstore.item.type')}:</td>
			<td>
				<select name="typeId" style="width:204px">
					<option></option>
					<#list types as type>
						<option value="${(type.id)!}">${(type.name)!}</option>
					</#list>
				</select>
			</td>
		</tr>
		<tr>
			<td class="name"><@required/>${i18n.getMessage('bookstore.item.id')}:</td>
			<td><input type="text" name="itemId" style="width:200px"/></td>
		</tr>
		<tr>
			<td class="name"><@required/>${i18n.getMessage('bookstore.item.price')}:</td>
			<td><input type="text" name="price" style="text-align:right;width:170px"/> ${i18n.getMessage('currency.vnd')}</td>
		</tr>
		<tr>
			<td class="name" style="vertical-align:top">${i18n.getMessage('comment')}:</td>
			<td><textarea name="comment" style="width:350px;height:80px;"></textarea></td>
		</tr>
		<tr>
			<td class="name"></td>
			<td>
				<input type="submit" value="${i18n.getMessage('add')}" class="button_style"/> 
				<input type="reset" value="${i18n.getMessage('reset')}" class="button_style"/> 
			</td>
		</tr>
	</table>
</form>
<@ajax.select baseUrl="ProgramTitleSearch.view" source="programId" target="titleId"
	parameters="programId={programId}" executeOnLoad=true defaultOptions="${(item.itemTitle.id)!}"/>